package com.gc.server.vo.down;


import com.alibaba.excel.annotation.ExcelIgnore;
import com.alibaba.excel.annotation.ExcelProperty;
import com.gc.server.entity.BusApplyEntity;
import com.gc.server.entity.CostApplyEntity;
import com.gc.server.enums.*;
import com.gc.server.vo.BusApplyVo;
import com.gc.server.vo.CostApplyVo;
import lombok.Data;

import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;

/**
 * 费用申请实体
 * 表名 cost_apply
 *
 * @author hxf
 * @email 505860922@qq.com
 * @date Wed Oct 21 17:34:54 CST 2020
 */
@Data
public class BusApplyDown implements Serializable {
    @ExcelIgnore
    private static final long serialVersionUID = 1L;

    //
    @ExcelProperty("")
    private Long id;

    //用户ID
    @ExcelProperty("用户ID")
    private Long userId;

    @ExcelProperty("申请人")
    private String userName;

    @ExcelProperty("开始时间")
    private Date startDate;

    @ExcelProperty("结束时间")
    private Date endDate;


    //ENUM-状态:"WAIT-待审核","PASS-通过","REFUSE-拒绝
    @ExcelIgnore
    private Integer status;
    @ExcelProperty("状态")
    private String statusStr;
    //ENUM-类型:"LEAVE-请假","TRIP-出差"
    @ExcelIgnore
    private Integer type;
    @ExcelProperty("类型")
    private String typeStr;

    @ExcelProperty("审核人")
    private String adminName;

    @ExcelProperty("申请日期")
    private Date time;
    @ExcelProperty("详细原因")
    private String info;
    @ExcelProperty("拒绝理由")
    private String remark;
    @ExcelIgnore
    private Integer leaveType;
    //ENUM-类型:"THING-事假","REST-调休","SICK-病假","YEAR-年假","MAT-产假","PMAT-陪产","MAR-婚假","OFF-例假","DEAD-丧假","MM-哺乳假"
    @ExcelProperty("请假类型")
    private String leaveTypeStr;
    @ExcelProperty("总小时")
    private BigDecimal hours;
    @ExcelProperty("出发地")
    private String startPlace;
    @ExcelProperty("目的地")
    private String endPlace;
    @ExcelProperty("路径")
    private String tripType;
    @ExcelProperty("出发方式")
    private String tripWay;
    @ExcelProperty("途径")
    private String midPlace;
    @ExcelProperty("申请表单ID")
    private Long aid;

    public BusApplyDown() {

    }

    public BusApplyDown(BusApplyVo vo) {
        BusApplyEntity entity = vo.getEntity();
        this.setId(entity.getId());
        this.setUserId(entity.getUserId());
        this.setUserName(vo.getUser().getName());
        this.setStartDate(entity.getStartDate());
        this.setEndDate(entity.getEndDate());
        this.setStartPlace(entity.getStartPlace());
        this.setEndPlace(entity.getEndPlace());
        this.setInfo(entity.getInfo());
        this.setRemark(entity.getRemark());
        this.setHours(entity.getHours());
        this.setTripWay(entity.getTripWay());
        this.setTripType(entity.getTripType());
        this.setType(entity.getType());
        this.setAid(entity.getAid());
        this.setMidPlace(entity.getMidPlace());
        this.setTime(entity.getTime());
        if (entity.getType() != null) {
            this.setTypeStr(BusApplyTypeEnum.indexOf(entity.getType()));
        }

        this.setStatus(entity.getStatus());
        if (entity.getStatus() != null) {
            this.setStatusStr(BusApplyStatusEnum.indexOf(entity.getStatus()));
        }

    }


}
